// 此处第二个参数vm，就是我们在页面使用的this，你可以通过vm获取vuex等操作，更多内容详见uView对拦截器的介绍部分：
// https://uviewui.com/js/http.html#%E4%BD%95%E8%B0%93%E8%AF%B7%E6%B1%82%E6%8B%A6%E6%88%AA%EF%BC%9F

// 引入分工api.js 
import dApi from "./divide/d-api.js"
import qApi from "./divide/q-api.js"


const http = uni.$u.http
// 此处使用了传入的params参数，一切自定义即可
const getApi = (data = {}, config) => http.get('/frontend/login/wechat', {
	params: data,
	...config
});
const postApi = (params = {}, config) => http.post('/frontend/yard/redeemRecord', params, config);
const getArea = (data = '', config) => http.get('/ruoyi/city/getByPid', {
	params: data,
	...config
});
const getAgreement = (data = '', config) => http.get('/system/agreement/getById', {
	params: data,
	...config
});
const getByKey = (data = '', config) => http.get('/system/config/getByKey', {
	params: data,
	...config
});
const getDictByType = (key = '', config) => http.get(`/system/dict/data/type/${key}`, config);
const loginFirst = (params = {}, config) => http.post('/frontend/user/login/first', params, config);
const phoneWechatLogin = (params = {}, config) => http.post('/frontend/user/login', params, config);
const getBanner = (params = {}, config) => http.post('/frontend/video/banner', params, config);
const getVideoList = (params = {}, config) => http.post('/frontend/video/list', params, config);
const getCourseList = (params = {}, config) => http.post('/frontend/course/list', params, config);
const getCourseDetail = (data = {}, config) => http.get('/frontend/course/detail', {
	params: data,
	...config
});
const collection = (data = {}, config) => http.get('/frontend/course/collection', {
	params: data,
	...config
});
const shareApi = (data = {}, config) => http.get('/frontend/user/share', {
	params: data,
	...config
});
const getUserInfo = (data = {}, config) => http.get('/frontend/user/info', {
	params: data,
	...config
});
const updateUser = (params = {}, config) => http.post('/frontend/user/update', params, config);
const getMemberCenter = (data = {}, config) => http.get('/frontend/membershipCard/memberCenter', {
	params: data,
	...config
});
const buyCard = (data = {}, config) => http.get('/frontend/order/create', {
	params: data,
	...config
});
const getOrderList = (params = {}, config) => http.post('/frontend/order/list', params, config);
const getPromotionUser = (data = {}, config) => http.get('/frontend/user/promotion/center', {
	params: data,
	...config
});
const getBalanceDetail = (params = {}, config) => http.post('/frontend/user/promotion/balanceDetail', params, config);
const getPromotionTeam = (params = {}, config) => http.post('/frontend/user/promotion/team', params, config);
const applicationWithdraw = (params = {}, config) => http.post('/frontend/withdraw/withdraw', params, config);
const getWithdrawRecord = (params = {}, config) => http.post('/frontend/withdraw/withdrawRecord', params, config);
const getCollectionList = (params = {}, config) => http.post('/frontend/course/collection/list', params, config);
const getIsVip = (data = {}, config) => http.get('/frontend/course/isVip', {
	params: data,
	...config
});

const getInfoList = (params = {}, config) => http.post('/frontend/info/list', params, config);
let apiList = {
	...dApi,
	...qApi,
	getApi, //get接口示例
	postApi, //post接口示例
	getArea, //获取城市接口
	getAgreement, //获取协议
	getByKey, //获取配置
	getDictByType, //获取字典
	loginFirst, //是否为新用户
	phoneWechatLogin, //微信登录
	getBanner, //轮播图
	getVideoList, //小程序视频列表
	getCourseList, //小程序课程列表-培训
	getCourseDetail, //小程序课程详情
	collection, //小程序课程收藏-取消收藏
	shareApi, //分享
	getUserInfo, //个人中心用户信息
	updateUser, //修改用户信息
	getMemberCenter, //会员中心
	buyCard, //购买会员卡
	getOrderList, //购买记录
	getPromotionUser, //推广中心上半部分(用户信息)
	getBalanceDetail, //推广中心(余额明细列表)
	getPromotionTeam, //推广中心下半部分(推广团队)
	applicationWithdraw, //用户申请提现
	getWithdrawRecord, //用户提现记录
	getCollectionList, //小程序课程收藏列表
	getIsVip, //判断用户是否是会员
	getInfoList,//小程序资讯列表
}
export default {
	...apiList
}